<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/12/22
 * Time: 11:07
 */
namespace app\web\service;

use app\web\util\AlibabaUtil;

class AliService{
    /**
     * @todo 获取授权连接
     * @author ZJF
     */
    public static function getAuthorUrl($state = ''){
        $ali_util = new AlibabaUtil();
        $url = $ali_util->createAuthUrl($state);
        return $url;
    }

    /**
     * @todo 转换卖家查询商品列表，商品状态
     * @author ZJF
     */
    public function changeStatusList($status = 0){
        if(empty($status) || !is_numeric($status)){
            return 0;
        }
        //商品状态，
        //published:上架状态，
        //expired：过期(包含手动过期与自动过期)，
        //TBD：to be delete，
        //deleted：删除，
        //new：新发，
        //modified：修改，
        //member expired：会员撤销
        switch($status){
            case 1:
                return 'published';
                break;
            case 2:
                return 'expired';
                break;
            case 3:
                return 'TBD';
                break;
            case 4:
                return 'deleted';
                break;
            case 5:
                return 'new';
                break;
            case 6:
                return 'modified';
                break;
            case 7:
                return 'member expired';
                break;
            default:
                return 0;
        }
    }
}